package 并发编程16.Lock和Condition的使用;

import java.util.concurrent.CountDownLatch;

/**
 * @author idea
 * @data 2019/2/17
 */
public class Consumer extends Thread {

    private ProductQueue<Integer> productQueue;

    private CountDownLatch countDownLatch;

    public Consumer(ProductQueue productQueue,CountDownLatch countDownLatch) {
        this.countDownLatch=countDownLatch;
        this.productQueue = productQueue;
    }

    @Override
    public void run() {
        try {
            countDownLatch.await();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        while (true){
            Integer number = productQueue.take();
        }

    }
}
